package com.bitjsc.server.data;

import java.util.HashMap;

public class Room  
{
	/**
	 * 
	 */
	private static final long serialVersionUID = 566503127691659718L;

	public HashMap<String, Player> players= new HashMap<String, Player>();
	public HashMap<String, Table> tables= new HashMap<String, Table>();
	public Table waitTable = null;
	private String name=null;
	public Room(String name)
	{
		
		this.name = name;
		this.waitTable = new Table("waitTable");
		this.tables.put("waitTable", this.waitTable);
		
	}
	public void addPlayer(Player player)
	{
		
		this.players.put(player.getClientID(), player);
		player.setCurrentRoom(this);
		
		
	}
	public void removePlayer(Player player)
	{
		this.players.remove(player.getName());
		player.setCurrentRoom(null);
		
	}
	public void invokeAll(String function , Object[] params)
	{
		
		for ( String key : this.players.keySet() )
		 {
			this.players.get(key).invoke(function, params);
		 }
	}
	public void setName(String name)
	{
		this.name = name;
	}
	public String getName()
	{
		return name;
	}
	
}
